<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="/style/basic_layout.css" rel="stylesheet" type="text/css">
    <link href="/style/common_style.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/jquery/jquery.js"></script>
    <script src="/js/plugins/artDialog/jquery.artDialog.js?skin=blue"></script>
    <script type="text/javascript" src="/js/plugins/jqueryForm/jquery.form.min.js"></script>
    <script type="text/javascript" src="/js/commonAll.js"></script>
    <title>WMS-采购订单管理</title>
    <style>
        .alt td {
            background: black !important;
        }
    </style>
<script>
    $(function () {
        $(".btn_audit").click(function () {
            //获取到当前请求事件源对象
            var auditUrl = $(this).data("url");
            showDialog("哥啊,您是要审核吗?想清楚!" ,function () {
                $.get(auditUrl,function (data) {
                    if (data.success){
                        showDialog("审核成功",function () {
                            //重新加载页面

                            window.location.reload();
                        })
                    }
                    
                })
            },true);
            
        })
    })
    
</script>
</head>
<body>
<form id="searchForm" action="/orderBill/list.do" method="post">
    <div id="container">
        <div class="ui_content">
            <div class="ui_text_indent">
                <div id="box_border">
                    <div id="box_top">采购订单管理</div>
                    <div id="box_bottom">
                        <input type="button" value="新增" class="ui_input_btn01 btn_input"
                               data-url="/orderBill/input.do"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="ui_content">
            <div class="ui_tb">
                <table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
                    <tr>
                        <th width="30"><input type="checkbox" id="all"/></th>
                        <th>编号</th>
                        <th>采购订单编码</th>
                        <th>业务时间</th>
                        <th>供应商</th>
                        <th>总金额</th>
                        <th>总数量</th>
                        <th>录入人</th>
                        <th>审核人</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    <tbody>
                    <c:forEach items="${pageResult.list}" var="item">
                        <tr>
                            <td><input type="checkbox" name="IDCheck" class="acb"/></td>
                            <td>${item.id}</td>
                            <td>${item.sn}</td>
                            <td>
                                <fmt:formatDate value="${item.vdate}" pattern="yyyy-MM-dd"/>
                            </td>
                            <td>${item.supplier.name}</td>
                            <td>${item.totalAmount}</td>
                            <td>${item.totalNumber}</td>
                            <td>${item.inputUser.name}</td>
                            <td>${item.auditor.name}</td>
                            <td>
                                <span style="color: ${item.status==0?'green':'red'}">${item.status==0?"未审核":"已审核"}</span>
                            </td>
                            <td>
                                <c:choose>
                                    <c:when test="${item.status==0}">
                                        <a href="/orderBill/input.do?id=${item.id}">编辑</a>
                                        <a href="javascript:;" class="btn_delete"
                                           data-url="/orderBill/delete.do?id=${item.id}">删除</a>
                                        <a href="javascript:;" class="btn_audit"
                                           data-url="/orderBill/audit.do?id=${item.id}">审核</a>
                                    </c:when>
                                    <c:otherwise>

                                        <a href="/orderBill/view.do?id=${item.id}">查看</a>
                                    </c:otherwise>
                                </c:choose>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
            <jsp:include page="/WEB-INF/views/common/common_page.jsp"/>
        </div>
    </div>
</form>
</body>
</html>
